import G3xObjBase from './G3xObjBase';
import * as g3xUtils from "@g3x/utils";
import * as mobx from 'mobx';

/**
 * 具备guid的对象的基类
 * @description 具备guid等属性，从该对象派生，可感知对象的创建销毁等操作。
 * @class
 * @extends G3xObjBase
 */
class G3xObj extends G3xObjBase {

  constructor(options) {

    options = options||{};

    const guid = options.guid || g3xUtils.GUID.generate32();
    options.hasOwnProperty('guid') && (delete options.guid);
    g3xUtils.g3x_defineReadonly(this, "guid", guid);

    super(options);

    mobx.extendObservable(this, { enabled: true, });
  }
}

export default G3xObj;
